﻿namespace Ymatou.UserAuth.Agent.Sso
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Web;
    using System.Web.SessionState;
    using Ymatou.UserAuth.Extension;
    /// <summary>
    /// sso 客户端退出 处理程序
    /// </summary>
    public class CLogOutHandler : IHttpHandler, IRequiresSessionState
    {
        public bool IsReusable
        {
            get { return false; }
        }

        public void ProcessRequest(HttpContext context)
        {
            if (context == null || SiteFilter.RequestInFilter(context.Request))
                return;

            context.Response.RemoveCookie(ConstParameter.YMATOUUSERLOGIN, doMain: SSOClient.SubDomain(context.Request.Url.Host));
            context.Response.RemoveCookie(ConstParameter.SSOCOOKIEKEY_CLIENT_SIGN, doMain: SSOClient.SubDomain(context.Request.Url.Host));
            try
            {
                //YmatouAuthentication.LogoutCookie();
            }
            catch
            { }
            context.Response.ContentType = "image/gif";
            ///HttpContext.Current.Session.Clear();
            //HttpContext.Current.Session.Abandon();

        }
    }
}
